#!/usr/env/bin python
#! coding:utf-8

"""
   主应用，启动服务

"""
import logging
from blog import app

if __name__ == '__main__':
    ## 日志相关配置
    handler = logging.FileHandler(filename=app.config['LOG_NAME'], encoding='UTF-8')
    handler.setLevel(logging.DEBUG)
    logging_format = logging.Formatter(
        '[%(asctime)s] - %(levelname)s - <%(filename)s [%(funcName)s : %(lineno)s]> - %(message)s')
    handler.setFormatter(logging_format)
    app.logger.addHandler(handler)

    #threaded是每个请求启动一个线程，可以使用supervisor管理进程
    app.run(host = app.config['HOST'],port = app.config['PORT'],threaded = True)
